#include "BJLGameLocalRecordData.h"
#include "CMD_BJLOx.h"

USING_NS_CC;
using namespace std;

BJLGameLocalRecordData* BJLGameLocalRecordData::s_pSingle = NULL;

BJLGameLocalRecordData* BJLGameLocalRecordData::getInstance()
{
	if (!s_pSingle)
	{
		s_pSingle = new BJLGameLocalRecordData();
	}
	return s_pSingle;
}

BJLGameLocalRecordData::BJLGameLocalRecordData()
:m_xian(0),
m_ping(0),
m_zhuang(0),
m_xiantian(0),
m_zhuangtian(0),
m_tongdui(0),
m_xiandui(0),
m_zhuangdui(0),
m_rightNum(0),
m_downNum(0),
m_HeNum(0),
m_hangNum(HANG_MAX),
m_CanSub(true)
{

}

void BJLGameLocalRecordData::loadAllRecordData()
{
	m_xian = UserDefault::getInstance()->getIntegerForKey("AREA_XIAN", 0);
	m_ping = UserDefault::getInstance()->getIntegerForKey("AREA_PING", 0);
	m_zhuang = UserDefault::getInstance()->getIntegerForKey("AREA_ZHUANG", 0);
	m_xiantian = UserDefault::getInstance()->getIntegerForKey("AREA_XIAN_TIAN", 0);
	m_zhuangtian = UserDefault::getInstance()->getIntegerForKey("AREA_ZHUANG_TIAN", 0);
	m_tongdui = UserDefault::getInstance()->getIntegerForKey("AREA_TONG_DUI", 0);
	m_xiandui = UserDefault::getInstance()->getIntegerForKey("AREA_XIAN_DUI", 0);
	m_zhuangdui = UserDefault::getInstance()->getIntegerForKey("AREA_ZHUANG_DUI", 0);
}
void BJLGameLocalRecordData::saveAllRecordData()
{
	UserDefault::getInstance()->setIntegerForKey("AREA_XIAN", m_xian);
	UserDefault::getInstance()->setIntegerForKey("AREA_PING", m_ping);
	UserDefault::getInstance()->setIntegerForKey("AREA_ZHUANG", m_zhuang);
	UserDefault::getInstance()->setIntegerForKey("AREA_XIAN_TIAN", m_xiantian);
	UserDefault::getInstance()->setIntegerForKey("AREA_ZHUANG_TIAN", m_zhuangtian);
	UserDefault::getInstance()->setIntegerForKey("AREA_TONG_DUI", m_tongdui);
	UserDefault::getInstance()->setIntegerForKey("AREA_XIAN_DUI", m_xiandui);
	UserDefault::getInstance()->setIntegerForKey("AREA_ZHUANG_DUI", m_zhuangdui);
	UserDefault::getInstance()->flush();
}
void BJLGameLocalRecordData::clearAllRecordData()
{
	//UserDefault::getInstance()->setIntegerForKey("AREA_XIAN", 0);
	//UserDefault::getInstance()->setIntegerForKey("AREA_PING", 0);
	//UserDefault::getInstance()->setIntegerForKey("AREA_ZHUANG", 0);
	//UserDefault::getInstance()->setIntegerForKey("AREA_XIAN_TIAN", 0);
	//UserDefault::getInstance()->setIntegerForKey("AREA_ZHUANG_TIAN", 0);
	//UserDefault::getInstance()->setIntegerForKey("AREA_TONG_DUI", 0);
	//UserDefault::getInstance()->setIntegerForKey("AREA_XIAN_DUI", 0);
	//UserDefault::getInstance()->setIntegerForKey("AREA_ZHUANG_DUI", 0);
	//UserDefault::getInstance()->flush();

	m_xian = 0;
	m_ping = 0;
	m_zhuang = 0;
	m_xiantian = 0;
	m_zhuangtian = 0;
	m_tongdui = 0;
	m_xiandui = 0;
	m_zhuangdui = 0;

	m_rightNum = 0;
	m_downNum = 0;
	m_HeNum = 0;
	m_hangNum = HANG_MAX; 
	m_ZPLRecord.clear();
}

void BJLGameLocalRecordData::setXianNum(int value)
{
	if (value == -1)
	{
		m_xian++;
	}
	else
	{
		m_xian = value;
	}
}
int BJLGameLocalRecordData::getXianNum()
{
	return m_xian;
}

void BJLGameLocalRecordData::setPingNum(int value)
{
	if (value == -1)
	{
		m_ping++;
	}
	else
	{
		m_ping = value;
	}
}
int BJLGameLocalRecordData::getPingNum()
{
	return m_ping;
}

void BJLGameLocalRecordData::setZhuangNum(int value)
{
	if (value == -1)
	{
		m_zhuang++;
	}
	else
	{
		m_zhuang = value;
	}
}
int BJLGameLocalRecordData::getZhuangNum()
{
	return m_zhuang;
}

void BJLGameLocalRecordData::setXianTianNum(int value)
{
	if (value == -1)
	{
		m_xiantian++;
	}
	else
	{
		m_xiantian = value;
	}
}
int BJLGameLocalRecordData::getXianTianNum()
{
	return m_xiantian;
}

void BJLGameLocalRecordData::setZhuangTianNum(int value)
{
	if (value == -1)
	{
		m_zhuangtian++;
	}
	else
	{
		m_zhuangtian = value;
	}
}
int BJLGameLocalRecordData::getZhuangTianNum()
{
	return m_zhuangtian;
}

void BJLGameLocalRecordData::setTongDuiNum(int value)
{
	if (value == -1)
	{
		m_tongdui++;
	}
	else
	{
		m_tongdui = value;
	}
}
int BJLGameLocalRecordData::getTongDuiNum()
{
	return m_tongdui;
}

void BJLGameLocalRecordData::setXianDuiNum(int value)
{
	if (value == -1)
	{
		m_xiandui++;
	}
	else
	{
		m_xiandui = value;
	}
}
int BJLGameLocalRecordData::getXianDuiNum()
{
	return m_xiandui;
}

void BJLGameLocalRecordData::setZhuangDuiNum(int value)
{
	if (value == -1)
	{
		m_zhuangdui++;
	}
	else
	{
		m_zhuangdui = value;
	}
}
int BJLGameLocalRecordData::getZhuangDuiNum()
{
	return m_zhuangdui;
}

void BJLGameLocalRecordData::setRightNum(int value)
{
	if (value == -1)
	{
		m_rightNum++;
	}
	else
	{
		m_rightNum = value;
	}
	
}
int  BJLGameLocalRecordData::getRightNum(){
	return m_rightNum;
}

void BJLGameLocalRecordData::setDownNum(int value)
{
	if (value == -1)
	{
		m_downNum++;
	}
	else
	{
		m_downNum = value;
	}	
}
int  BJLGameLocalRecordData::getDownNum()
{
	return m_downNum;
}

void BJLGameLocalRecordData::setHeNum(int value)
{
	if (value == -1)
	{
		m_HeNum++;
	}
	else
	{
		m_HeNum = value;
	}
}
int  BJLGameLocalRecordData::getHeNum()
{
	return m_HeNum;
}

void BJLGameLocalRecordData::setHangNum(int value)
{
	m_hangNum = value;
}
void BJLGameLocalRecordData::subHangNum()
{
	m_hangNum--;
}
int BJLGameLocalRecordData::getHangNum()
{
	return m_hangNum;
}

void BJLGameLocalRecordData::clearZPLRecord()
{
	m_ZPLRecord.clear();
}
void BJLGameLocalRecordData::addZPLRecord(int value)
{
	m_ZPLRecord.push_back(value);
}
std::vector<int> BJLGameLocalRecordData::getZPLRecord()
{
	return m_ZPLRecord;
}